<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
  <title>登录</title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="static/css/login.css">
</head>

<body>
<div class="login-container">
  <h1>登录</h1>
  <p class="error">${msg}</p>
  <p class="success">${success}</p>
  <form action="login" method="post">
    <label for="username">用户名</label>
    <input type="text" id="username" name="username" placeholder="请输入用户名" autofocus>

    <label for="password">密码</label>
    <input type="password" id="password" name="password" placeholder="请输入密码">

    <label for="captcha">验证码</label>
    <input type="text" id="captcha" name="captcha" maxlength="4" minlength="4" placeholder="请输入验证码">
    <img id="img" src="captcha" alt="验证码" />

    <button type="submit">登录</button>
  </form>

  <div class="register">
    <a href="register.jsp">注册</a>
  </div>
</div>

<script>
  // 验证码刷新
  document.querySelector('#img').onclick = function () {
    this.src = 'captcha?t=' + new Date().getTime();
  }
</script>
</body>
</html>

